
#include "main.h"
#include "debug.h"




//**********************************************************

static pthread_t  main_timer_thread;

//**********************************************************


void* main_timer_task(void *arg)
{

	struct timeval timer;	

	while(1)
	{
		usleep(1000);

		timer.tv_sec  = 1;
		timer.tv_usec = 0;

		switch(select(0, NULL, NULL, NULL, &timer)) 
		{
		case -1:  
			log_e("Error!\n");
			break;
		case 0: 
			break;
		default:break;
		}
	}
}


int main(int argc, char *argv[])
{
	int i     = 0;
	int ret   = 0;
	
	log_i("******************************************************\n");
	log_i("*********************rkmpp player*********************\n");
	log_i("******************************************************\n");

	lib_drm_init();

#if 0
	lvgl_gui_init();

	lv_demo_music();

    while(1)
	{
		usleep(10);
    }
#endif
	
	key_board_init();
	key_mouse_init();
	//******************************************************************
	system_para_get();

	parameter_parsing(argc,argv);
	//******************************************************************

	queue_frame_init();
	message_packet_init();
	//******************************************************************
	lib_jpeg_init();
	
	lib_rga_init();

	lib_mpp_init();

	lib_alsa_init();
	lib_ffmpeg_init();
	//******************************************************************
	
	app_net_create();
	//******************************************************************

	app_photo_create();
	//******************************************************************
	
	app_video_create();
	//******************************************************************

	ret=pthread_create(&main_timer_thread, NULL, main_timer_task, NULL);
	if(ret != 0){
		log_e("thread error=%s\n",strerror(ret));
	}
	//******************************************************************

    while(1)
	{
		usleep(10);
    }

	//******************************************************************

    return 0;
}

